//
//  UIViewController+Mac.m
//  ArtCircle
//
//  Created by sunbin on 2017/5/22.
//  Copyright © 2017年 HuaYue. All rights reserved.
//

#import "UIViewController+Mac.h"

@implementation UIViewController (Mac)


- (void)pushAndPop:(UIViewController *)popView range:(NSRange )makeRange {

    NSArray *ctlAry = [self.navigationController viewControllers];
    [ctlAry enumerateObjectsUsingBlock:^(UIViewController *Ctl, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([Ctl isKindOfClass:[popView class]]) {
            NSMutableArray *array = [self.navigationController.viewControllers mutableCopy];
            [array removeObjectsInRange:makeRange];
            
            [self.navigationController setViewControllers:[array copy] animated:YES];
        }
    }];

}



- (void)PasswordLoginCompleDataSaveAccount:(NSString *)account pwd:(NSString *)pwd uid:(NSString *)uid data:(NSDictionary *)data {
    
    [YConfig saveOwnAccount:account andPassword:pwd];
    [[YConfig sharedYConfig] insertData:data];
    

    [YConfig saveOwnID:IF_NULL_TO_STRING(uid)];

}


- (void)quickLoginCompleDataSaveAccount:(NSString *)account uid:(NSString *)uid data:(NSDictionary *)data {

    
    [YConfig saveOwnAccount:account andPassword:nil];
    [[YConfig sharedYConfig] insertData:data];
    
    
    [YConfig saveOwnID:uid];


}

@end
